﻿using LeRenard.Libraries.PlatformInspection.InfoNodes;
using System;
using System.Collections.Generic;
using System.Linq;

namespace LeRenard.Libraries.PlatformInspection.Inspectors.Environment
{
    /// <summary>
    /// Scans for the logical drives on this environment.
    /// </summary>
    public class LogicalDrivesEnvironmentInspectorModule : InspectorModule<EnvironmentInspector>
    {
        /// <summary>
        /// Constructions
        /// </summary>
        public LogicalDrivesEnvironmentInspectorModule() 
            : base("Logical Drives") 
        { 
        }

        /// <summary>
        /// Gets the information this module gathers.
        /// </summary>        
        protected override IEnumerable<InfoNode> GetInformationImpl()
        {
            var infoNodes = new List<InfoNode>();

            foreach (var logicalDrive in System.Environment.GetLogicalDrives())            
                infoNodes.Add(new InfoNode(
                    logicalDrive, 
                    displayStrategy: InfoNodeEmptyValueDisplayStrategy.TreatAsNormalInfoNodeWithoutValue
                ));

            return infoNodes.OrderBy(inf => inf.Name);
        }
    }
}
